<?php

namespace App\Jobs;

use App\Server\CardsServer;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class CardCreateJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $batchId;
    protected $currentNum;
    protected $money;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($batch_id, $current_num, $money)
    {
        $this->batchId = $batch_id;
        $this->currentNum = $current_num;
        $this->money = $money;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(CardsServer $server)
    {
        $server->createCards($this->batchId, $this->currentNum, $this->money);
    }
}
